﻿@{
    ViewBag.Title = "会员升级";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<link href="../../Scripts/jquery-validation-engine/css/template.css" rel="stylesheet"
    type="text/css" />
<link href="../../Scripts/jquery-validation-engine/css/validationEngine.jquery.css"
    rel="stylesheet" type="text/css" />
<script src="../../Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="../../Scripts/jquery-validation-engine/js/jquery.validationEngine.js"
    type="text/javascript"></script>
<script src="../../Scripts/jquery-validation-engine/js/languages/jquery.validationEngine-zh_CN.js"
    type="text/javascript"></script>
<script type="text/javascript">
    $(function () {
        $("#form1").validationEngine({
            promptPosition: "centerRight"
        });
    });

    function checkUser() {
        var userName = $("#txtUserName").val();
        if (userName == null || userName == '')
            return;

        var isValid = false;
        var message = '';

        $.ajax({
            url: '/Users/CanUpdate',
            type: "GET",
            async: false,
            data: { userName: userName },
            success: function (data) {
                isValid = data.result;
                message = data.message;
            }
        });

        if (!isValid) {
            return message;
        }


    }
</script>
<div class="right_box_card">
    <ul>
        <li class="right_box_card1"><a href="#">会员升级</a></li>
    </ul>
</div>
@using (Html.BeginForm("Update1", "Users", FormMethod.Post, new { id = "form1" }))
{

    <table class="enter_tab" width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr height="40">
            <td class="entry_tab_td1" width="15%">
                会员账号：
            </td>
            <td class="entry_tab_td2 red">
                <input type="text" id="txtUserName" name="UserName" class="text-input validate[required,funcCall[checkUser]]" />
            </td>
        </tr>
        <tr height="40">
            <td class="entry_tab_td1" width="15%">
            </td>
            <td class="entry_tab_td2 red">
                <input type="submit" class="submit" style="float: left" value="下一步" />
            </td>
        </tr>
    </table>
}